package cn.ickck.law_paper_final.service.Impl;

import cn.ickck.law_paper_final.mapper.GdbDAO;
import cn.ickck.law_paper_final.mapper.GdbMapper;
import cn.ickck.law_paper_final.model.entity.Gdb;
import cn.ickck.law_paper_final.service.GdbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: ck
 * @Description:
 * @Date: Create in 21:33 2020/11/27
 */
@Service
public class GdbServiceImpl  implements GdbService {

    @Autowired
    private GdbMapper gdbMapper;

    @Autowired
    private GdbDAO gdbDAO;

    @Override
    public Integer insert(Gdb gdb) {
        return gdbDAO.insertSelective(gdb);
    }


    @Override
    public Integer deleteById(Integer id) {
        return gdbMapper.deleteById(id);
    }

    @Override
    public int count() {
        return gdbMapper.count();
    }


    @Override
    public List<Gdb> selectByPage(int start, int end) {
        return gdbMapper.selectByPage(start,end);
    }


    @Override
    public List<Gdb> findByNameOrKey(String key) {
        return gdbMapper.selectByNameOrKey(key);
    }

    @Override
    public Integer deleteByKey(String keyById) {
        return gdbMapper.deleteByKey(keyById);
    }

    @Override
    public void update(Gdb gdb) {
        gdbDAO.updateByPrimaryKeySelective(gdb);
    }
}
